3.4.11 \(\int (d \tan (e+f x))^n (a+i a \tan (e+f x))^3 \, dx\) [311]

Optimal. Leaf size=127 \[ -\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}+\frac {4 a^3 \, _2F_1(1,1+n;2+n;i \tan (e+f x)) (d \tan (e+f x))^{1+n}}{d f (1+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)} \]

[Out]

-a^3*(5+2*n)*(d*tan(f*x+e))^(1+n)/d/f/(1+n)/(2+n)+4*a^3*hypergeom([1, 1+n],[2+n],I*tan(f*x+e))*(d*tan(f*x+e))^
(1+n)/d/f/(1+n)-(d*tan(f*x+e))^(1+n)*(a^3+I*a^3*tan(f*x+e))/d/f/(2+n)

________________________________________________________________________________________

Rubi [A]
time = 0.18, antiderivative size = 127, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.192, Rules used = {3637, 3673, 3618, 12, 66} \begin {gather*} \frac {4 a^3 (d \tan (e+f x))^{n+1} \, _2F_1(1,n+1;n+2;i \tan (e+f x))}{d f (n+1)}-\frac {a^3 (2 n+5) (d \tan (e+f x))^{n+1}}{d f (n+1) (n+2)}-\frac {\left (a^3+i a^3 \tan (e+f x)\right ) (d \tan (e+f x))^{n+1}}{d f (n+2)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(d*Tan[e + f*x])^n*(a + I*a*Tan[e + f*x])^3,x]

[Out]

-((a^3*(5 + 2*n)*(d*Tan[e + f*x])^(1 + n))/(d*f*(1 + n)*(2 + n))) + (4*a^3*Hypergeometric2F1[1, 1 + n, 2 + n,
I*Tan[e + f*x]]*(d*Tan[e + f*x])^(1 + n))/(d*f*(1 + n)) - ((d*Tan[e + f*x])^(1 + n)*(a^3 + I*a^3*Tan[e + f*x])
)/(d*f*(2 + n))

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 66

Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[c^n*((b*x)^(m + 1)/(b*(m + 1)))*Hypergeometr
ic2F1[-n, m + 1, m + 2, (-d)*(x/c)], x] /; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[m] && (IntegerQ[n] || (GtQ[
c, 0] &&  !(EqQ[n, -2^(-1)] && EqQ[c^2 - d^2, 0] && GtQ[-d/(b*c), 0])))

Rule 3618

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[c*(
d/f), Subst[Int[(a + (b/d)*x)^m/(d^2 + c*x), x], x, d*Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m}, x] &&
NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[c^2 + d^2, 0]

Rule 3637

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim
p[b^2*(a + b*Tan[e + f*x])^(m - 2)*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(m + n - 1))), x] + Dist[a/(d*(m + n - 1
)), Int[(a + b*Tan[e + f*x])^(m - 2)*(c + d*Tan[e + f*x])^n*Simp[b*c*(m - 2) + a*d*(m + 2*n) + (a*c*(m - 2) +
b*d*(3*m + 2*n - 4))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a
^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && GtQ[m, 1] && NeQ[m + n - 1, 0] && (IntegerQ[m] || Intege
rsQ[2*m, 2*n])

Rule 3673

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B*d*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e
 + f*x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b
*c - a*d, 0] &&  !LeQ[m, -1]

Rubi steps

\begin {align*} \int (d \tan (e+f x))^n (a+i a \tan (e+f x))^3 \, dx &=-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}+\frac {a \int (d \tan (e+f x))^n (a+i a \tan (e+f x)) (a d (3+2 n)+i a d (5+2 n) \tan (e+f x)) \, dx}{d (2+n)}\\ &=-\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}+\frac {a \int (d \tan (e+f x))^n \left (4 a^2 d (2+n)+4 i a^2 d (2+n) \tan (e+f x)\right ) \, dx}{d (2+n)}\\ &=-\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}+\frac {\left (16 i a^5 d (2+n)\right ) \text {Subst}\left (\int \frac {4^{-n} \left (-\frac {i x}{a^2 (2+n)}\right )^n}{-16 a^4 d^2 (2+n)^2+4 a^2 d (2+n) x} \, dx,x,4 i a^2 d (2+n) \tan (e+f x)\right )}{f}\\ &=-\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}+\frac {\left (i 4^{2-n} a^5 d (2+n)\right ) \text {Subst}\left (\int \frac {\left (-\frac {i x}{a^2 (2+n)}\right )^n}{-16 a^4 d^2 (2+n)^2+4 a^2 d (2+n) x} \, dx,x,4 i a^2 d (2+n) \tan (e+f x)\right )}{f}\\ &=-\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}+\frac {4 a^3 \, _2F_1(1,1+n;2+n;i \tan (e+f x)) (d \tan (e+f x))^{1+n}}{d f (1+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(900\) vs. \(2(127)=254\).
time = 8.29, size = 900, normalized size = 7.09 \begin {gather*} \frac {\cos ^3(e+f x) \left (\frac {\sec ^2(e+f x) (-i \cos (3 e)-\sin (3 e))}{2+n}+\frac {(-3-2 n+\cos (2 e)) \sec ^2(e) \left (-\frac {1}{2} i \cos (3 e)-\frac {1}{2} \sin (3 e)\right )}{(1+n) (2+n)}+\frac {(-\cos (e-f x)+\cos (e+f x)) \sec ^2(e) \sec (e+f x) \left (-\frac {1}{2} i \cos (3 e)-\frac {1}{2} \sin (3 e)\right )}{1+n}\right ) (d \tan (e+f x))^n (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {\cos ^3(e+f x) \left (\frac {\sec ^2(e) (-1+\cos (2 e)+3 i \sin (2 e)) \left (\frac {1}{2} i \cos (3 e)+\frac {1}{2} \sin (3 e)\right )}{1+n}+\frac {\sec ^2(e) \sec (e+f x) \left (\frac {1}{2} i \cos (3 e)+\frac {1}{2} \sin (3 e)\right ) (-\cos (e-f x)+\cos (e+f x)-3 i \sin (e-f x)+3 i \sin (e+f x))}{1+n}\right ) (d \tan (e+f x))^n (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {i 2^{2-n} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^n \cos ^3(e+f x) \left (2^n \, _2F_1\left (1,n;1+n;-\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )-\left (1+e^{2 i (e+f x)}\right )^n \, _2F_1\left (n,n;1+n;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )\right ) \tan ^{-n}(e+f x) (d \tan (e+f x))^n (a+i a \tan (e+f x))^3}{\left (e^{i e}+e^{3 i e}\right ) f n (\cos (f x)+i \sin (f x))^3}-\frac {4 i e^{-3 i e} \left (-1+e^{2 i (e+f x)}\right )^n \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^n \left (\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^{-n} \cos ^3(e+f x) \left (-\frac {\left (1+e^{2 i (e+f x)}\right )^{-n} \, _2F_1\left (1,n;1+n;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )}{n}-\frac {\left (1+e^{2 i e}\right ) \left (-1+e^{2 i (e+f x)}\right ) \left (1+e^{2 i (e+f x)}\right )^{-1-n} \, _2F_1\left (1,1+n;2+n;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )}{1+n}+\frac {2^{-n} \, _2F_1\left (n,n;1+n;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )}{n}\right ) \tan ^{-n}(e+f x) (d \tan (e+f x))^n (a+i a \tan (e+f x))^3}{\left (1+e^{2 i e}\right ) f (\cos (f x)+i \sin (f x))^3} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

Integrate[(d*Tan[e + f*x])^n*(a + I*a*Tan[e + f*x])^3,x]

[Out]

(Cos[e + f*x]^3*((Sec[e + f*x]^2*((-I)*Cos[3*e] - Sin[3*e]))/(2 + n) + ((-3 - 2*n + Cos[2*e])*Sec[e]^2*((-1/2*
I)*Cos[3*e] - Sin[3*e]/2))/((1 + n)*(2 + n)) + ((-Cos[e - f*x] + Cos[e + f*x])*Sec[e]^2*Sec[e + f*x]*((-1/2*I)
*Cos[3*e] - Sin[3*e]/2))/(1 + n))*(d*Tan[e + f*x])^n*(a + I*a*Tan[e + f*x])^3)/(f*(Cos[f*x] + I*Sin[f*x])^3) +
 (Cos[e + f*x]^3*((Sec[e]^2*(-1 + Cos[2*e] + (3*I)*Sin[2*e])*((I/2)*Cos[3*e] + Sin[3*e]/2))/(1 + n) + (Sec[e]^
2*Sec[e + f*x]*((I/2)*Cos[3*e] + Sin[3*e]/2)*(-Cos[e - f*x] + Cos[e + f*x] - (3*I)*Sin[e - f*x] + (3*I)*Sin[e
+ f*x]))/(1 + n))*(d*Tan[e + f*x])^n*(a + I*a*Tan[e + f*x])^3)/(f*(Cos[f*x] + I*Sin[f*x])^3) + (I*2^(2 - n)*((
(-I)*(-1 + E^((2*I)*(e + f*x))))/(1 + E^((2*I)*(e + f*x))))^n*Cos[e + f*x]^3*(2^n*Hypergeometric2F1[1, n, 1 +
n, -((-1 + E^((2*I)*(e + f*x)))/(1 + E^((2*I)*(e + f*x))))] - (1 + E^((2*I)*(e + f*x)))^n*Hypergeometric2F1[n,
 n, 1 + n, (1 - E^((2*I)*(e + f*x)))/2])*(d*Tan[e + f*x])^n*(a + I*a*Tan[e + f*x])^3)/((E^(I*e) + E^((3*I)*e))
*f*n*(Cos[f*x] + I*Sin[f*x])^3*Tan[e + f*x]^n) - ((4*I)*(-1 + E^((2*I)*(e + f*x)))^n*(((-I)*(-1 + E^((2*I)*(e
+ f*x))))/(1 + E^((2*I)*(e + f*x))))^n*Cos[e + f*x]^3*(-(Hypergeometric2F1[1, n, 1 + n, (1 - E^((2*I)*(e + f*x
)))/(1 + E^((2*I)*(e + f*x)))]/((1 + E^((2*I)*(e + f*x)))^n*n)) - ((1 + E^((2*I)*e))*(-1 + E^((2*I)*(e + f*x))
)*(1 + E^((2*I)*(e + f*x)))^(-1 - n)*Hypergeometric2F1[1, 1 + n, 2 + n, (1 - E^((2*I)*(e + f*x)))/(1 + E^((2*I
)*(e + f*x)))])/(1 + n) + Hypergeometric2F1[n, n, 1 + n, (1 - E^((2*I)*(e + f*x)))/2]/(2^n*n))*(d*Tan[e + f*x]
)^n*(a + I*a*Tan[e + f*x])^3)/(E^((3*I)*e)*(1 + E^((2*I)*e))*((-1 + E^((2*I)*(e + f*x)))/(1 + E^((2*I)*(e + f*
x))))^n*f*(Cos[f*x] + I*Sin[f*x])^3*Tan[e + f*x]^n)

________________________________________________________________________________________

Maple [F]
time = 1.03, size = 0, normalized size = 0.00 \[\int \left (d \tan \left (f x +e \right )\right )^{n} \left (a +i a \tan \left (f x +e \right )\right )^{3}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*tan(f*x+e))^n*(a+I*a*tan(f*x+e))^3,x)

[Out]

int((d*tan(f*x+e))^n*(a+I*a*tan(f*x+e))^3,x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*tan(f*x+e))^n*(a+I*a*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

integrate((I*a*tan(f*x + e) + a)^3*(d*tan(f*x + e))^n, x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*tan(f*x+e))^n*(a+I*a*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

integral(8*a^3*((-I*d*e^(2*I*f*x + 2*I*e) + I*d)/(e^(2*I*f*x + 2*I*e) + 1))^n*e^(6*I*f*x + 6*I*e)/(e^(6*I*f*x
+ 6*I*e) + 3*e^(4*I*f*x + 4*I*e) + 3*e^(2*I*f*x + 2*I*e) + 1), x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - i a^{3} \left (\int i \left (d \tan {\left (e + f x \right )}\right )^{n}\, dx + \int \left (- 3 \left (d \tan {\left (e + f x \right )}\right )^{n} \tan {\left (e + f x \right )}\right )\, dx + \int \left (d \tan {\left (e + f x \right )}\right )^{n} \tan ^{3}{\left (e + f x \right )}\, dx + \int \left (- 3 i \left (d \tan {\left (e + f x \right )}\right )^{n} \tan ^{2}{\left (e + f x \right )}\right )\, dx\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*tan(f*x+e))**n*(a+I*a*tan(f*x+e))**3,x)

[Out]

-I*a**3*(Integral(I*(d*tan(e + f*x))**n, x) + Integral(-3*(d*tan(e + f*x))**n*tan(e + f*x), x) + Integral((d*t
an(e + f*x))**n*tan(e + f*x)**3, x) + Integral(-3*I*(d*tan(e + f*x))**n*tan(e + f*x)**2, x))

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*tan(f*x+e))^n*(a+I*a*tan(f*x+e))^3,x, algorithm="giac")

[Out]

integrate((I*a*tan(f*x + e) + a)^3*(d*tan(f*x + e))^n, x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (d\,\mathrm {tan}\left (e+f\,x\right )\right )}^n\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^3 \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*tan(e + f*x))^n*(a + a*tan(e + f*x)*1i)^3,x)

[Out]

int((d*tan(e + f*x))^n*(a + a*tan(e + f*x)*1i)^3, x)

________________________________________________________________________________________